<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="0" />
<title><?php echo C("SITE_NAME");?>管理后台</title>
<link rel="shortcut icon" href=" /favicon.ico" />
<link rel="stylesheet" href="/Static/admin/css/component-min.css">
<link rel="stylesheet" href="/Static/admin/css/home.2015.05.22-09.32.css">
<link rel="stylesheet" href="/Static/admin/icon/iconfont.css">
<!--弹窗-->
<script src="http://libs.baidu.com/jquery/1.9.1/jquery.min.js"></script>
<script src="/Static/admin/js/layer-2.x/layer.js?v=1.9.0"></script>
<script src="/Static/admin/js/common.js"></script>
<script>
	var UPYUN_DOMAIN = '<?php echo C("UPYUN_DOMAIN");?>';
</script>
</head>
<body class="cp-bodybox">
<!--[if lt IE 9]>
<div class="alert alert-danger disable-del txtCenter" id="tipLowIEVer">
    <h4>系统检测到您使用的浏览器版本过低，为达到更好的体验效果请升级您的浏览器，我们为您推荐：</h4>
    <p>
        <a href="http://www.firefox.com.cn/download/" target="_blank">Firefox浏览器</a>
        <a href="http://www.maxthon.cn/" target="_blank">遨游浏览器</a>
        <a href="http://se.360.cn/" target="_blank">360浏览器</a>
    </p>
</div>
<![endif]-->
<style>
.header-nav-list a {
  display: block;
  padding: 0 10px;
  min-width: 70px;
  line-height: 53px;
  font-size: 14px;
  text-align: center;
  font-weight: 700;
}
</style>

<div class="header">
    <div class="inner clearfix">
        <div class="fl">
            <a href="/" class="header-logo">
                <img
                    src="<?php echo C('UPYUN_DOMAIN'); echo C('SITE_TOPLOGO2');?>"
                    onerror="javascript:this.src='/Static/admin/images/error.png';"
                    ></a>
        </div>
        <!-- end logo -->

        <div class="header-nav fl">
            <ul class="header-nav-list clearfix">
                <!--<li class="fl <?php echo ($controller == 'index')?'active':'';?>"><a href="/admin">首页</a></li>-->
                <?php foreach($MENU as $k=>$v){?>
                <li class="fl <?php echo ($controller == $v['controller'])?'active':'';?>">
                    <a href="<?php echo $v['url'];?>"><?php echo $v['title'];?></a>
                </li>
                <?php } ?>
            </ul>
        </div>
        <!-- end header-nav -->

        <div class="fr">
            <ul class="header-ctrl clearfix">
                <li class="header-ctrl-item fl"><a href="/admin/login/logout">退出</a></li>
            </ul>
        </div>

        <span class="account_inbox_switch fr"></span>
        <span class="header-welcome fr">
            <a href="javasecript:;" class="tips" data-trigger="hover" data-placement="top"><?php echo $admininfo['username'];?></a>
        </span>

    </div>
</div>
<!-- end header -->
	<div class="container">
		<div class="inner clearfix">
	<div class="content-left fl">
    <?php foreach($SUBMENU as $subkey=>$sub){ ?>
    <dl class="left-menu shop_8">
        <dt>
            <i class="icon-menu home"></i> <span id="shop_0" data-id="0"><?=$sub['title']?></span>
        </dt>
        <?php foreach($sub['menu'] as $menu){ ?>
        <dd class="<?php echo ($action == $menu["action"])?'active':'';?>">
            <a href="<?=$menu['url']?>"><?=$menu['title']?></a>
        </dd>
        <?php } ?>
    </dl>
    <?php } ?>
</div>
<script src="/Static/admin/js/laydate/laydate.js"></script>
<style>
  .wxtables td .btn {padding: 0px 6px;}
  #J_wx_fans{ vertical-align:-2px; margin-top:5px;}	
  .select.mini.new{ width:140px;}
  input.mini.Wdate{ width:100px;}
  </style>
<div class="content-right fl">

    <h1 class="content-right-title">会员列表<!--  <a
			class="gicon-info-sign gicon_linkother" href="http://#"
			target="_blank"></a>-->
	</h1>
    
    <div class="tablesWrap">
        <form action="" method="get" name="form1">
	    <div class="tables-searchbox">
                <input type="text" class="input mini" name="user_id" id="user_id" value="<?php echo get('user_id');?>" placeholder="用户ID">
                <input type="text" class="input mini" name="nickname" id="nickname" value="<?php echo get('nickname');?>" placeholder="姓名/微信昵称">
                <input type="hidden" name="p" value="1">
                <input type="text" class="input mini" name="mobile" value="<?php echo get('mobile');?>" placeholder="手机">
                <select name="grade_id" class="select mini new" id="grade_id">
                    <option value="" selected="">所有等级</option>
                    
                    <?php foreach($grade_arr as $k=>$v){ ?>
                    <option value="<?php echo $k;?>"  <?php if($k==get('grade_id')){echo "selected";}?>><?php echo $v;?></option>
      				<?php } ?>
      				
                </select>
                <input type="text" name="start_create_time" id="start_create_time" value="<?php echo get('start_create_time');?>" placeholder="注册时间" class="input mini Wdate">
                <span class="mgr5">至</span>
                <input type="text" name="end_create_time" id="end_create_time" value="<?php echo get('end_create_time');?>" placeholder="注册时间" class="input mini Wdate">

                <button class="btn btn-primary" >
						<i class="gicon-search white"></i>查询</button>
                <a href="/admin/member/index" class="btn btn-warning">清除查询</a>
                <a class="btn btn-success J_export" target="_blank" href="javascript:excel();"><i class="gicon-share white"></i>导出</a>
                
         </div>
         <div class="tabs clearfix mgt10">
			<a href="/admin/member/index" class="<?php echo (!$grade)?'active':'';?> tabs_a fl">全部(<?php echo $count[0];?>)</a>
                        <?php foreach($grade_arr as $gk=>$gv) { ?>
                        <a href="/admin/member/index?grade=<?=$gk?>" class="<?php echo ($grade==$gk)?'active':'';?> tabs_a fl"><?=$gv?>(<?php echo $count[$gk];?>)</a>
                        <?php } ?>
		</div>
	        <div>
	        
<script type="text/javascript">
function excel(){

	var res = "";
	var grade_id = $("#grade_id").val();
	var user_id = $("#user_id").val();
	var start_create_time = $("#start_create_time").val();
	var end_create_time = $("#end_create_time").val();

	var url_1 = "/admin/member/memberpage/?grade_id="+grade_id+"&user_id="+user_id+"&start_create_time="+start_create_time+"&end_create_time="+end_create_time;
	var url_2 = "/admin/member/memberexcel/?grade_id="+grade_id+"&user_id="+user_id+"&start_create_time="+start_create_time+"&end_create_time="+end_create_time;
	//查找页数
	$.ajax({
		url : url_1,
		type : "GET",
		dataType : 'json',
	//	async: false,
		success : function(data) {
			
			layer.closeAll('loading');//关闭正在加载
			if(data.ret == 0){
				// 成功
				var messagetype = 1;
			}else{
				// 失败
				var messagetype = 2;
			}

			layer.msg(data.msg, {icon: messagetype},function(){

				if(data.data==0){
					layer.msg("无数据", {icon: 2});
				}else if(data.data>0){

					var html = '<div style="padding:50px;">';
					for(i=1;i<=data.data;i++){

						var haha = url_2+"&p="+i;
						

						html += '<br><a href="'+haha+'" target="_blank" style="font-size:20px">下载'+i+'</a><br>';
						
						
					}
					
					html += '</div>';
					
					layer.open({
						title:"请分别点击下面的链接下载文件,每个文件最多包含5000条数据",
					    type: 1,
					    skin: 'layui-layer-rim', //加上边框
					    area: ['500px', '500px'], //宽高
					    content: html
					});
					
					
				}
				
			});
		},
		beforeSend:function(){
			layer.closeAll();//关闭
			layer.load();//正在加载
       },
       error: function() {
		   layer.closeAll('loading');//关闭正在加载
		   layer.msg("网络错误,请重试", {icon: 2});
       }
       
	});
	


	
	layer.closeAll();//关闭
}


</script>


            </div>
            </form>
	    </div>
	    <!-- end tables-searchbox -->
	    <table class="wxtables" style="margin-top:10px;">  
            <colgroup>  
                <col width="10%">
                <col width="8%">
                <col width="8%">
                <col width="6%">
                <col width="6%">
                <col width="6%">
                <col width="6%">
                <col width="6%">
            </colgroup>  
            <thead>
                <tr>  
                    <td>用户</td>
                    <td>用户信息</td>
                    <td>销售统计</td>
                    <td>上级</td>
                    <td>账户</td>
                    <td>是否关注</td>
                    <td>加入时间</td>
                    <td>操作</td>
                </tr> 
            </thead>
            <tbody>
                
            
            <?php foreach($datalist as $k=>$v){ ?>
                <tr>
                	<td><a style="color:blue;" target="_blank" href="/admin/member/index?user_id=<?php echo $v['uid'];?>"><img src="<?php echo $v['headimgurl'];?>" width="60" height="60"  onerror="javascript:this.src='/Static//admin/images/error.png';" ></a>
                	<br>
                	<?php echo emoji_unified_to_html($v['nickname']);; ?><br>
                        <?=$v['realname']?><br>
               
                	<br>
                	 ID: <?php echo $v['uid'];?><br>
                        </td> 
                        <td>
                           手机：<?php echo $v['mobile'];?><br>          	
                           等级: <?php echo $v['grade_name'];?><br/> 
                           <?php if($v['area']) { ?>
                            代理地区: <?php echo $v['area']['area_name'];?><br/> 
                            <?php } ?>
                        </td>
                        <td>
                        洗护库存： <?php echo $v['stock'];?><br>
                        <?php if($v['vip_num']>0){ ?>
                        调整VIP名额： <?php echo $v['vip_num'];?><br>
                        <?php } ?>
                        </td>
                        <td>上级:<a style="color:blue;" target="_blank" href="/admin/member/index?user_id=<?php echo $v['refer_uid'];?>"><?php echo $v['refer_nickname'];?></a>
                        <br>
                        上级ID: <?php echo $v['refer_uid'];?>
                    </td>
                    <td>
                        年终奖:<a><?php echo $v['year_money'];?></a><br>

                        可用<?php echo C("YONGJIN_NAME");?>:<a><?php echo $v['money'];?></a><br>
                        锁定<?php echo C("YONGJIN_NAME");?>: <?php echo $v['lock_money'];?><br>
               		    已提现: <a style="color:blue;" target="_blank" href="/admin/finance/index?uid=<?=$v[uid]?>"><?php echo $v['tixian'];?></a><br>
                        
                        <!-- <?php echo C("SCORE_NAME");?>: <?php echo $v['score'];?><br> -->
                        
                    </td>
                    <td><?php echo $v['subscribe'] ? "<span style='color:green;'>是</span>" : "<span style='color:red;'>否</span>";?></td>
                    
                    <td><?php echo $v['create_time'];?></td>
                    <td>
                    <!--<a class="btn btn-success btn-small" href="javascript:resetPassword(<?php echo $v['uid'];?>)">重置登录密码</a>-->
                    <a target="_blank" class="btn btn-primary btn-small" href="/admin/member/edituser/?edit_uid=<?php echo $v['uid'];?>">编辑</a>
                    </td>
				</tr>
			<?php } ?>

			</tbody>
        </table>
        
	<div class="tables-btmctrl clearfix">
           <div class="mgt10">
               <div class="paginate">
                  <?php echo ($page); ?>
               </div>
           </div>
	</div>
        
        
</div>
<script>
	var start = {
		elem : '#start_create_time',
		format : 'YYYY-MM-DD hh:mm:ss',
		min : '2015-11-01 00:00:00', //设定最小日期
		max : laydate.now(), //最大日期为当前日期
		istime : true,
		istoday : false,
		choose : function(datas) {
			end.min = datas; //开始日选好后，重置结束日的最小日期
			end.start = datas //将结束日的初始值设定为开始日
		}
	};
	var end = {
		elem : '#end_create_time',
		format : 'YYYY-MM-DD hh:mm:ss',
		min : '2015-11-01 00:00:00', //设定最小日期
		max : laydate.now(),
		istime : true,
		istoday : false,
		choose : function(datas) {
			start.max = datas; //结束日选好后，重置开始日的最大日期
		}
	};
	laydate(start);
	laydate(end);
	function getpassword(uid){
            
            layer.load();     
            $.get('/admin/member/getpassword?uid='+uid,function(data){
                layer.closeAll();
            if(data.ret == 0){
                // 成功
                var messagetype = 1;
                  layer.alert(data.msg, {icon: 6});
            }else{
                // 失败
                var messagetype = 2;
                layer.msg(data.msg,{icon: 2});
            }
		})
	}
        
        function resetPassword(uid){
            var title = "请注意,重置密码后无法撤消";
            layer.confirm(title, {
                btn: ['确定','我再想想'] //按钮
            }, function(){
                getpassword(uid);
            }, function(){
                    layer.msg('你取消了提交', {icon: 7});
            });
        }
        function resetpayPassword(uid){
            var title = "请注意,重置密码后无法撤消";
            layer.confirm(title, {
                btn: ['确定','我再想想'] //按钮
            }, function(){
                layer.load();     
                $.get('/admin/member/getpaypassword?uid='+uid,function(data){
                    layer.closeAll();
                    if(data.ret == 0){
                        // 成功
                        layer.msg(data.msg, {icon: 1});
                    }else{
                        // 失败
                        layer.msg(data.msg,{icon: 2});
                    }
                })
            }, function(){
                    layer.msg('你取消了提交', {icon: 7});
            });
        }

</script>

		</div>
	</div>
<!--gonggao-->
<div class="footer">&copy; <?php echo date("Y");?> <?php echo C("SITE_NAME");?> , Inc. All rights reserved.</div>
<a href="#" id="j-gotop" class="gotop" title="回到顶部" style="right:45px; display: inline;"></a>
<script type="text/javascript">
$(function(){
    var height1=$(".content-right").height();
    var height2=$(".content-left").height();
    if(parseInt(height1) < parseInt(height2)){
        $(".content-right").css({'min-height': height2});
    }
    $(window).scroll(function() {
		$(this).scrollTop() >= 150 ? $("#j-gotop").fadeIn(300) : $("#j-gotop").fadeOut(300)
	});
});
</script>
</body>
</html>